home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / dialog / rc.h < prev    next >
Text File  |  1994-01-08  |  6KB  |  224 lines

  1. /*
  2.  *  rc.h -- declarations for configuration file processing
  3.  *
  4.  *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
  5.  *
  6.  *  This program is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU General Public License
  8.  *  as published by the Free Software Foundation; either version 2
  9.  *  of the License, or (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21.  
  22. #define DIALOGRC ".dialogrc"
  23. #define VAR_LEN 30
  24. #define COMMENT_LEN 70
  25.  
  26. /* Types of values */
  27. #define VAL_INT  0
  28. #define VAL_STR  1
  29. #define VAL_BOOL 2
  30. #define VAL_ATTR 3
  31.  
  32. /* Type of line in configuration file */
  33. #define LINE_BLANK    2
  34. #define LINE_COMMENT  1
  35. #define LINE_OK       0
  36. #define LINE_ERROR   -1
  37.  
  38. /* number of configuration variables */
  39. #define VAR_COUNT        (sizeof(vars) / sizeof(vars_st))
  40.  
  41. /* check if character is white space */
  42. #define whitespace(c)    (c == ' ' || c == '\t')
  43.  
  44. /* check if character is string quoting characters */
  45. #define isquote(c)       (c == '"' || c == '\'')
  46.  
  47. /* get last character of string */
  48. #define lastch(str)      str[strlen(str)-1]
  49.  
  50. /*
  51.  * Configuration variables
  52.  */
  53. typedef struct {
  54.   char      name[VAR_LEN];  /* name of configuration variable as in DIALOGRC */
  55.   void     *var;            /* address of actually variable to change */
  56.   int       type;           /* type of value */
  57.   char      comment[COMMENT_LEN];    /* comment to put in "rc" file */
  58. } vars_st;
  59.  
  60. vars_st vars[] = {
  61.   {  "use_shadow",
  62.      &use_shadow,
  63.      VAL_BOOL,
  64.      "Shadow dialog boxes? This also turns on color."                        },
  65.  
  66.   {  "use_colors",
  67.      &use_colors,
  68.      VAL_BOOL,
  69.      "Turn color support ON or OFF"                                          },
  70.  
  71.   {  "screen_color",
  72.      color_table[0],
  73.      VAL_ATTR,
  74.      "Screen color"                                                          },
  75.  
  76.   {  "shadow_color",
  77.      color_table[1],
  78.      VAL_ATTR,
  79.      "Shadow color"                                                          },
  80.  
  81.   {  "dialog_color",
  82.      color_table[2],
  83.      VAL_ATTR,
  84.      "Dialog box color"                                                      },
  85.  
  86.   {  "title_color",
  87.      color_table[3],
  88.      VAL_ATTR,
  89.      "Dialog box title color"                                                },
  90.  
  91.   {  "border_color",
  92.      color_table[4],
  93.      VAL_ATTR,
  94.      "Dialog box border color"                                               },
  95.  
  96.   {  "button_active_color",
  97.      color_table[5],
  98.      VAL_ATTR,
  99.      "Active button color"                                                   },
  100.  
  101.   {  "button_inactive_color",
  102.      color_table[6],
  103.      VAL_ATTR,
  104.      "Inactive button color"                                                 },
  105.  
  106.   {  "button_key_active_color",
  107.      color_table[7],
  108.      VAL_ATTR,
  109.      "Active button key color"                                               },
  110.  
  111.   {  "button_key_inactive_color",
  112.      color_table[8],
  113.      VAL_ATTR,
  114.      "Inactive button key color"                                             },
  115.  
  116.   {  "button_label_active_color",
  117.      color_table[9],
  118.      VAL_ATTR,
  119.      "Active button label color"                                             },
  120.  
  121.   {  "button_label_inactive_color",
  122.      color_table[10],
  123.      VAL_ATTR,
  124.      "Inactive button label color"                                           },
  125.  
  126.   {  "inputbox_color",
  127.      color_table[11],
  128.      VAL_ATTR,
  129.      "Input box color"                                                       },
  130.  
  131.   {  "inputbox_border_color",
  132.      color_table[12],
  133.      VAL_ATTR,
  134.      "Input box border color"                                                },
  135.  
  136.   {  "searchbox_color",
  137.      color_table[13],
  138.      VAL_ATTR,
  139.      "Search box color"                                                      },
  140.  
  141.   {  "searchbox_title_color",
  142.      color_table[14],
  143.      VAL_ATTR,
  144.      "Search box title color"                                                },
  145.  
  146.   {  "searchbox_border_color",
  147.      color_table[15],
  148.      VAL_ATTR,
  149.      "Search box border color"                                               },
  150.  
  151.   {  "position_indicator_color",
  152.      color_table[16],
  153.      VAL_ATTR,
  154.      "File position indicator color"                                         },
  155.  
  156.   {  "menubox_color",
  157.      color_table[17],
  158.      VAL_ATTR,
  159.      "Menu box color"                                                        },
  160.  
  161.   {  "menubox_border_color",
  162.      color_table[18],
  163.      VAL_ATTR,
  164.      "Menu box border color"                                                 },
  165.  
  166.   {  "item_color",
  167.      color_table[19],
  168.      VAL_ATTR,
  169.      "Item color"                                                            },
  170.  
  171.   {  "item_selected_color",
  172.      color_table[20],
  173.      VAL_ATTR,
  174.      "Selected item color"                                                   },
  175.  
  176.   {  "tag_color",
  177.      color_table[21],
  178.      VAL_ATTR,
  179.      "Tag color"                                                             },
  180.  
  181.   {  "tag_selected_color",
  182.      color_table[22],
  183.      VAL_ATTR,
  184.      "Selected tag color"                                                    },
  185.  
  186.   {  "tag_key_color",
  187.      color_table[23],
  188.      VAL_ATTR,
  189.      "Tag key color"                                                         },
  190.  
  191.   {  "tag_key_selected_color",
  192.      color_table[24],
  193.      VAL_ATTR,
  194.      "Selected tag key color"                                                },
  195.  
  196.   {  "check_color",
  197.      color_table[25],
  198.      VAL_ATTR,
  199.      "Check box color"                                                       },
  200.  
  201.   {  "check_selected_color",
  202.      color_table[26],
  203.      VAL_ATTR,
  204.      "Selected check box color"                                              },
  205.  
  206.   {  "uarrow_color",
  207.      color_table[27],
  208.      VAL_ATTR,
  209.      "Up arrow color"                                                        },
  210.  
  211.   {  "darrow_color",
  212.      color_table[28],
  213.      VAL_ATTR,
  214.      "Down arrow color"                                                      }
  215. };    /* vars */
  216.  
  217.  
  218.  
  219. /*
  220.  * Routines to process configuration file
  221.  */
  222. void create_rc(char *filename);
  223. int parse_rc(void);
  224.